package com.csweimei.rentmanagementtreasure.tenant.ui.act.customer;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.lifecycle.ViewModelProviders;

import com.chad.library.BR;
import com.csweimei.rentmanagementtreasure.R;
import com.csweimei.rentmanagementtreasure.base.AppViewModelFactory;
import com.csweimei.rentmanagementtreasure.databinding.ActivityAddFollowBinding;
import com.csweimei.rentmanagementtreasure.http.entity.CustomerBean;
import com.csweimei.rentmanagementtreasure.http.entity.HouseListBean;
import com.csweimei.rentmanagementtreasure.tenant.viewModel.AddFollowVM;
import com.csweimei.rentmanagementtreasure.tenant.viewModel.FollowHouseVM;

import me.goldze.mvvmhabit.base.BaseActivity;

public class AddFollowKHActivity extends BaseActivity<ActivityAddFollowBinding, AddFollowVM> {


    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_add_follow;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        super.initData();
        viewModel.setActivity(this);
    }

    @Override
    public AddFollowVM initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getApplication());
        return ViewModelProviders.of(this,factory).get(AddFollowVM.class);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == 10087){
            CustomerBean.DataDTO bean = (CustomerBean.DataDTO) data.getSerializableExtra("data");
            viewModel.customid.set(bean.getId()+"");
            viewModel.customMsg.set(bean.getName());
        }
    }
}